use "ESStrend.dta", clear
      
set scheme s1mono, permanent

 keep if yrbrn>1943
 keep if yrbrn<1998
 
 keep if Age>22
 
  drop if cntry=="IL" | cntry=="GB" | cntry=="CH"
 
 g Uni=.
 replace Uni=0 if University==0 
 replace Uni=1 if University==1 & Bologna==0
 replace Uni=2 if University==1 & Bologna==1
 
 gen yrbrn_bin = floor(yrbrn/4)*4
 
 collapse Meritocracy_ordinal  Consumerism_ordinal    Equality_ordinal    Environment_ordinal  Meritocracy  Consumerism Equality Environment, by( Uni yrbrn_bin)
 
 rename yrbrn_bin yrbrn
 
 	   grstyle init
	 grstyle set legend 2,  nobox
	 grstyle set size 8pt: tick_label key_label
	 grstyle set size 12pt: heading
	 grstyle set size 10pt: subheading axis_title
    grstyle set graphsize 10cm 10cm 	
 
  twoway (line Meritocracy_ordinal   yrbrn if  Uni==0, lcolor(gs10)  lwidth(medthick) lpattern(dash)   legend(label(1 "no Diploma") ))   (line Meritocracy_ordinal   yrbrn if Uni==1, lwidth(medthick) lpattern(dash)  lcolor(black) legend(label(2 "Diploma") )) (line Meritocracy_ordinal   yrbrn if Uni==2, lwidth(medthick)   lcolor(black) legend(label(3 "Diploma Bologna") )), title("", size(medsmall)) xtitle("Cohort") ytitle("")     legend(position(12) rows(1) span  size(small)) title("{bf:(a) Personal achievement: status}", size(medlarge))  xscale(range(1945, 1995)) xlab(1945 (5) 1995, grid gstyle(minor)) yscale(range(0.2, .8)) ylab(0.2(0.1) .8, grid gstyle(minor))
graph save a1 , replace
  
   
    twoway (line Consumerism_ordinal   yrbrn if  Uni==0,  lcolor(gs10) lpattern(dash) lwidth(medthick)    legend(label(1 "no Diploma") ))   (line Consumerism_ordinal   yrbrn if Uni==1, lcolor(black) lpattern(dash)  lwidth(medthick)    legend(label(2 "Diploma") )) (line Consumerism_ordinal   yrbrn if Uni==2, lwidth(medthick)   lcolor(black) legend(label(3 "Diploma Bologna") )), title("", size(medsmall))  ytitle("")  xtitle("Cohort") legend(position(12) rows(1) span  size(small)) title("{bf:(b) Personal achievement: money}", size(medlarge))  xscale(range(1945, 1995)) xlab(1945 (5) 1995, grid gstyle(minor)) yscale(range(0.2, .8)) ylab(0.2 (0.1) .8, grid gstyle(minor))
graph save a2 , replace  
 
 
    twoway (line Equality_ordinal   yrbrn if  Uni==0, lwidth(medthick)    lcolor(gs10) lpattern(dash)  legend(label(1 "no Diploma") ))   (line Equality_ordinal   yrbrn if Uni==1, lwidth(medthick) lpattern(dash)   lcolor(black) legend(label(2 "Diploma")  )) (line Equality_ordinal yrbrn if Uni==2, lwidth(medthick)    lcolor(black) legend(label(3 "Diploma Bologna"))), title("", size(medsmall))  ytitle("")   xtitle("Cohort")  ylabel("",angle(vertical) labsize(small))  legend(position(12) rows(1) span  size(small)) title("{bf:(c) Global justice: equality}", size(medlarge))   xscale(range(1945, 1995)) xlab(1945 (5) 1995, grid gstyle(minor)) yscale(range(0.4, 1)) ylab(0.4 (0.1) 1, grid gstyle(minor))
graph save a3 , replace  
  
 
    twoway (line Environment_ordinal   yrbrn if  Uni==0, lwidth(medthick)     lcolor(gs10) lpattern(dash) lwidth(medthink)  legend(label(1 "no Diploma") ))   (line Environment_ordinal   yrbrn if Uni==1, lcolor(black) lpattern(dash)  lwidth(medthick)    legend(label(2 "Diploma") )) (line Environment_ordinal   yrbrn if Uni==2, lcolor(black)   lwidth(medthick)    legend(label(3 "Diploma Bologna") )),  xtitle("Cohort") title("", size(small))  ytitle("")   ylabel("",angle(vertical) labsize(small))  legend(position(12) rows(1) span  size(small)) title("{bf:(d) Global justice: environment}", size(medlarge))  xscale(range(1945, 1995)) xlab(1945 (5) 1995, grid gstyle(minor)) yscale(range(0.4, 1)) ylab(0.4(0.1) 1, grid gstyle(minor))
graph save a4 , replace
 
 	   grstyle init
	 grstyle set legend 2,  nobox
	 grstyle set size 8pt: tick_label key_label
	 grstyle set size 12pt: heading
	 grstyle set size 10pt: subheading axis_title
    grstyle set graphsize 24cm 36cm 	
graph combine a1.gph a2.gph a3.gph a4.gph, rows(2)
graph export "Figure4.png", replace 

erase a1.gph a2.gph a3.gph a4.gph
